/**
 * @fileOverview
 * WashizuMahjong.
 * http://code.google.com/p/washizu-mahjong/
 */
/**
 * @namespace
 * The round detail
 */
var RoundDetail = {
	/**
	 * The number of the round. If it is 東二局, its value is 2.
	 * @type Number
	 */
	number: 1,
	/**
	 * The code of the round. The value will be 東(East): 0; 南(South): 1; 西(West): 2; 北(North): 3.
	 * @type Number
	 * @default 0
	 */
	code: 0,
	/**
	 * @type String
	 * @see RoundDetail#code
	 */
	get round_char(){
		switch(this.code){
			case 0:
				return "\u6771";
			case 1:
				return "\u5357";
			case 2:
				return "\u897f";
			case 3:
				return "\u5317";
			default:
				return "\u6771";
		}
	},
	/**
	 * The round name.
	 * @type String
	 */
	get round_name(){
		var getChineseNum = function(code){
			function c(z){switch(z){case 1:return"\u4e00";case 2:return"\u4e8c";case 3:return"\u4e09";case 4:return"\u56db";case 5:return"\u4e94";case 6:return"\u516d";case 7:return"\u4e03";case 8:return"\u516b";case 9:return"\u4e5d"; default: return "";}};
			if(code < 10)
				return c(code);
			else if(code < 20)
				return "十" + c(code % 10)

		}
		if(this.counterSticks == 0){
			return this.round_char + getChineseNum(this.number) + "\u5c40";
		}else{
			return this.round_char + getChineseNum(this.number) + "\u5c40\t" + getChineseNum(this.counterSticks) + "\u672c\u5834";
		}
	},
	/**
	 * 場棒
	 * @type Number
	 */
	counterSticks: 0,
	/**
	 * <ruby>親<rp>（</rp><rt>おや</rt><rp>）</rp></ruby>.
	 * The dealer of the round.
	 * @see Game.startNewGame
	 * @see Game.startNewRound
	 */
	dealer: 0,
	/**
	 * The number of how many tiles are picked up
	 * @type Number
	 * @see MAX_DISCARD_TILES
	 */
	pickedUpTilesNum: 0,
	/**
	 * For each round, the total number of the times of kong is 4. This number is the numbers of kong in a round
	 * @type Number
	 * @default 0
	 */
	kongTimes: 0,
	/**
	 * @type MahjongTile[]
	 */
	discardTiles: []
};

/**
 * @namespace
 * Mahjong Type
 * @see MahjongTile#tileType
 * @see MahjongTile#typeCode
 */
var MahjongType = {
	/**
	 * 餅
	 * @type Number
	 */
	Pin: 0,
	/**
	 * 萬
	 * @type Number
	 */
	Wan: 1,
	/**
	 * 索
	 * @type Number
	 */
	Sou: 2,
	/**
	 * 字牌
	 * @type Number
	 */
	Word: 3
}

/**
 * @namespace
 * The num code of Mahjong Word Tiles
 * @see Mahjong#wordNum
 */
var MahjongWordNumCode = {
	/**
	 * 東
	 * @type Number
	 */
	East: 0,
	/**
	 * 南
	 * @type Number
	 */
	South: 1,
	/**
	 * 西
	 * @type Number
	 */
	West: 2,
	/**
	 * 北
	 * @type Number
	 */
	North: 3,
	/**
	 * 白
	 * @type Number
	 */
	Haku: 4,
	/**
	 * 發
	 * @type Number
	 */
	Hatsu: 5,
	/**
	 * 中
	 * @type Number
	 */
	Chun: 6
}


/**
 * @namespace
 * @see Meld
 */
var MeldType = {
	/**
	 * 槓
	 * @type String
	 */
	KONG: "KONG",
	/**
	 * 碰
	 * @type String
	 */
	PONG: "PONG",
	/**
	 * 吃
	 * @type String
	 */
	CHOW: "CHOW",
	/**
	 * @type String
	 */
	NONE: "NONE"
}

/**
 * @namespace
 * @see Player#canKong
 * @see Player#kongAction
 */
var KongType = {
	/**
	 * 暗槓
	 * The closed quad whose kong tile is in the hand
	 * @type Number
	 * @readonly
	 */
	Closed_Quad_from_Hand: 1,
	/**
	 * 暗槓.
	 * The closed quad whose kong tile is the picking up tile.
	 * @type Number
	 * @readonly
	 */
	Closed_Quad_from_PickupTile: 2,
	/**
	 * 大明槓
	 * @type Number
	 * @readonly
	 */
	Open_Quad: 3,
	/**
	 * 加槓
	 * @type Number
	 * @readonly
	 */
	Added_Open_Quad: 4,
	/**
	 * @type Number
	 * @readonly
	 */
	None: 0
}
 
/**
 * Since sometimes players use different rule to play the game. Therefore use this object to set the rule.
 * @namespace
 */
var Rules = {
	/**
	 * @description 赤ドラ. <br />
	 * allow Red Dora
	 * @type Boolean
	 */
	Red_Dora : false,
	/**
	 * @description The simple number of Red Doras. It may be 3, 5, or 7.
	 *
	 * @type Number
	 */
	Red_Dora_Num: 5,
	/**
	 * @description ダブル役満.<br />
	 * Double Yakuman
	 * @type Boolean
	 */
	Double_Yakuman : true,
	/**
	 * @description <ruby>青天井ルール<rp>（</rp><rt>あおてんじょうルール</rt><rp>）</rp></ruby>.<br />
	 * In this rule, the socore winner get does not have the maxium number.
	 * @type Boolean
	 */
	Aotenjou : false,
	/**
	 * @type Number
	 */
	Score_Per_Sticks: 100,
	/**
	 * @see Game.AbortiveDraws
	 * @type Boolean
	 */
	Multiple_Agari: true,
	/**
	 * @see Game.AbortiveDraws.tripleRon
	 * @type Boolean
	 */
	Triple_Ron: false,
	/**
	 * @see Game.AbortiveDraws
	 * @type Boolean
	 */
	Four_Richies: false
};


/**
 * @namespace
 */
var Special_Fu_Value = {
	/**
	 * 国士無双
	 * @type Number
	 */
	Thirteen_Orphans: 30,
	/**
	 * 七対子
	 * @type Number
	 */
	Seven_Pairs: 25
};
